home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / rss / findfirs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  949 b   |  36 lines

  1. /*
  2.                             F I N D F I R S . C
  3.  
  4.     Note on the MSDOS platforms:
  5.  
  6.     With file specifications terminating in a relative path (i.e.,
  7.     terminating in . or ..) _dos_findfirst() fails, and findfirst() will
  8.     fail too.
  9.  
  10. */
  11.  
  12. #include "icrssdef.h"
  13.  
  14. ICMAKE_FIND_
  15.     ifs;                                    /* icmake find-struct */
  16.  
  17. char *findfirst(char *fspec, unsigned attrib)
  18. {
  19.     char
  20.         *cp;                                /* pointer to matched filename */
  21.  
  22.     ifs.attrib = attrib;                    /* initialize ifs */
  23.  
  24.                                             /* find all entries */
  25.     if (_dos_findfirst(fspec, (unsigned)-1, &ifs.find))
  26.         return (NULL);                      /* failed already: return NULL */
  27.  
  28.     return
  29.     (
  30.         (cp = filefound()) ?                /* attrib/pattern ok: return */
  31.             cp
  32.         :
  33.             findnext()                      /* or retry a match */
  34.     );
  35. }
  36.